/**
 * Created with IntelliJ IDEA
 * Description
 * User:user
 * Date:2021-10-20
 * Time:15:47
 */
//编写一个类Calculator,有两个属性num1,num2,这两个数据的值，不能在定义的同时初始化，最后实现加减乘
//除四种运算.
/*class Calculator{
    private int num1;
    private int num2;

    public int getNum1() {
        return num1;
    }

    public void setNum1(int num1) {
        this.num1 = num1;
    }

    public int getNum2() {
        return num2;
    }

    public void setNum2(int num2) {
        this.num2 = num2;
    }
    public int add(){
        return  this.num1+this.num2;
    }
    public int sub(){
        return this.num1 - this.num2;
    }
    public int mul(){
        return this.num1 * this.num2;
    }
    public double dev(){
        return this.num1*1.0/this.num2;
    }
}
public class HomeWork {
    public static void main(String[] args) {
        Calculator calculator = new Calculator();
        calculator.setNum1(10);
        calculator.setNum2(20);
        System.out.println(calculator.add());
        System.out.println(calculator.sub());
        System.out.println(calculator.mul());
        System.out.println(calculator.dev());
    }
}*/
/*

//设计一个包含多个构造函数的类，并用这些构造函数进行实例对象
class Test{
    private String name;
    private int age;

    public Test(){
        System.out.println("没有参数的构造方法");
    }
    public Test(String name){
        this.name = name;
        System.out.println("1个参数的构造方法");
    }
    public Test(String name,int age){
        this.name = name;
        this.age = age;
        System.out.println("2个参数的构造方法");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;

    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "test{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
public class HomeWork {
    public static void main(String[] args) {
        Test test = new Test();
        Test test2 = new Test("bit");
        Test test3 = new Test("bite",10);
    }
}*/

////实现交换两个变量值
//class MyValue {
//    public int val;
//}
//
//public class HomeWork{
//    public static void swap(MyValue mv1,MyValue mv2){
//        int tmp = mv1.val;
//        mv1.val = mv2.val;
//        mv2.val = tmp;
//    }
//    public static void main(String[] args) {
//        MyValue myValue1 = new MyValue();
//        myValue1.val = 10;
//        MyValue myValue2 = new MyValue();
//        myValue2.val = 20;
//        System.out.println(myValue1.val + " " + myValue2.val);
//        swap(myValue1, myValue2);
//        System.out.println(myValue1.val + " " + myValue2.val);
//    }
//}